package util.thread.callable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.Callable;

/**
 * Callable 的使用场景，捕获线程内的异常、得到线程中的一个结果
 *
 * @author root
 */
public class DoOneCallable implements Callable<Object> {

    private static final Logger logger = LoggerFactory.getLogger(DoOneCallable.class);

    @Override
    public Object call() {
        try {
            logger.info("test Thread!");
            return 4 / 0;
        } catch (Exception e) {
            throw e;
        }
    }
}
